﻿<Window x:Class="GameListCreator.MainWindow"
        xmlns:my="clr-namespace:GameListCreator.Controls"     
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:GameListCreator.Converters"
        Title="GameList Creator" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        MinWidth="594" MinHeight="466"
        Height="590" Width="790" Icon="/GameListCreator;component/GameListCreator.ico">

    
    
    <Window.Resources>
        <Storyboard x:Key="StoryboardOpen">
            
            <!-- Selector -->
            
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="GameSelector">
                <EasingDoubleKeyFrame KeyTime="0" Value="30">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="GameSelector">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>

            <!-- Editor -->
            
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="GameEditor">
                <EasingDoubleKeyFrame KeyTime="0" Value="-30">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="GameEditor">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>

            <!-- Message -->
            
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="StackPanelMessage">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="StackPanelMessage">
                <DiscreteObjectKeyFrame KeyTime="0:0:1" Value="{x:Static Visibility.Collapsed}"/>
            </ObjectAnimationUsingKeyFrames>

        </Storyboard>

        <!-- ** Close ** -->
        
        <Storyboard x:Key="StoryboardClose">

            <!-- Selector -->

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="GameSelector">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="30">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="GameSelector">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <!-- Editor -->

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="GameEditor">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-30">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ElasticEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="GameEditor">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <!-- Message -->
            
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="StackPanelMessage">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="StackPanelMessage">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>

        </Storyboard>

        <!-- Converter -->
        <converters:VisibilityConverter x:Key="VisibilityConverter"></converters:VisibilityConverter>

    </Window.Resources>

    <Grid>
        <Grid VerticalAlignment="Top" Margin="30,30,10,0">

            <StackPanel HorizontalAlignment="Left" Margin="0,-15,0,0" Orientation="Horizontal">
                <Image VerticalAlignment="Center" Margin="0,10,5,0" Source="Images/GameListCreator.png" Width="32"></Image>

                <StackPanel>

                    <TextBlock Foreground="DarkGray" FontSize="15" Text="creator" HorizontalAlignment="Right" Margin="0,0,0,-10"></TextBlock>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Game" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="32" />
                        <TextBlock FontFamily="Segoe UI" FontSize="32" Margin="0,0,0,0" Text="List" VerticalAlignment="Center" Foreground="DodgerBlue" />
                    </StackPanel>
                </StackPanel>
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
                <my:RoundButton x:Name="ButtonNew" Content="New" IconSource="Images/Buttons/Plus.png" Margin="20,0,0,0" Opacity="0.5" Click="ButtonNew_Click" />
                <my:RoundButton x:Name="ButtonOpen" Content="Open" IconSource="Images/Buttons/Open.png" Margin="20,0,0,0" Opacity="0.5" Click="ButtonOpen_Click" />
                <my:RoundButton x:Name="ButtonSave" Content="Save" IconSource="Images/Buttons/Save.png" Margin="20,0,0,0" Opacity="0.5" Click="ButtonSave_Click"/>
                <my:RoundButton x:Name="ButtonDelete" Content="Delete" IconSource="Images/Buttons/Delete.png" Margin="20,0,0,0" Opacity="0.5" Click="ButtonDelete_Click"/>
            </StackPanel>

        </Grid>

        <Rectangle Height="20" HorizontalAlignment="Right" Margin="0,0,50,0" Name="rectangle1" VerticalAlignment="Top" Width="124" Fill="DodgerBlue" />
        <Rectangle Width="20" Fill="DodgerBlue" Height="124" HorizontalAlignment="Left" Name="rectangle2" VerticalAlignment="Center" />

        <Grid Margin="30,80,10,10">

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" MinWidth="250"></ColumnDefinition>
                <ColumnDefinition Width="*" MinWidth="250"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <my:GameSelector x:Name="GameSelector" BorderThickness="1" BorderBrush="LightGray" Margin="5,5,10,5" RenderTransformOrigin="0,0">
                <my:GameSelector.RenderTransform>
                    <RotateTransform></RotateTransform>
                </my:GameSelector.RenderTransform>
            </my:GameSelector>

            <Grid Grid.Column="2" x:Name="GameEditor" RenderTransformOrigin="1,0">

                <Grid.RenderTransform>
                    <RotateTransform></RotateTransform>
                </Grid.RenderTransform>

                <!-- Message -->
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding HasSelectedGame, Converter={StaticResource VisibilityConverter}, ConverterParameter=True}">

                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <TextBlock Text="Select a game or press" Style="{StaticResource TitleForm}"></TextBlock>
                        <my:RoundButton IconSource="Images/Buttons/Plus.png" Margin="0,0,-5,0" Opacity="0.5" Click="ButtonNewGame_Click" />
                    </StackPanel>

                    <TextBlock Text="to create a new game." HorizontalAlignment="Center" Style="{StaticResource TitleForm}"></TextBlock>

                </StackPanel>

                <my:GameEditor BorderThickness="1" BorderBrush="LightGray" Margin="0,5,5,5" Visibility="{Binding HasSelectedGame, Converter={StaticResource VisibilityConverter}, ConverterParameter=False}">
                </my:GameEditor>

            </Grid>
                        
            <GridSplitter x:Name="GridSplitter" Visibility="Collapsed" Grid.Column="0" Width="10" Background="Transparent"/>

            <!-- Message -->
            <StackPanel x:Name="StackPanelMessage" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center">

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                    <TextBlock Text="Press" Style="{StaticResource TitleForm}"></TextBlock>
                    <my:RoundButton IconSource="Images/Buttons/Plus.png" Margin="0,0,-5,0" Opacity="0.5" Click="ButtonNew_Click" />
                    <TextBlock Text="or" Style="{StaticResource TitleForm}"></TextBlock>
                    <my:RoundButton IconSource="Images/Buttons/Open.png" Margin="0,0,-5,0" Opacity="0.5" Click="ButtonOpen_Click" />
                </StackPanel>

                <TextBlock HorizontalAlignment="Center" Text="to create or open a GameList" Style="{StaticResource TitleForm}"></TextBlock>

            </StackPanel>

        </Grid>

        <!--<Grid Background="Black" Opacity="0.2" Visibility="{Binding MainViewModel.WaitScreenVisibility}"></Grid>-->

    </Grid>
</Window>
